//
//  YYJsonService.m
//  优悦一族
//
//  Created by liang on 2017/7/11.
//  Copyright © 2017年 umed. All rights reserved.
//

#import "YYJsonService.h"
#import "CTAppContext.h"
#import <CLNetWorkApiManager/CTNetworkingConfigurationManager.h>
#import <CLNetWorkApiManager/NSString+CTNetworkingMethods.h>

#define TimeStamp [[NSDate date] timeIntervalSince1970]
#define SALT @"qwertyasdfgzxcvb12345"
@implementation YYJsonService

-(BOOL)isOnline {
    
    return [CTNetworkingConfigurationManager sharedInstance].serviceIsOnline;
}

//apiBaseUrl

-(NSString *)offlineApiBaseUrl {
    
    return @"http://172.20.87.24:8080/youyueyizu_api";
}

-(NSString *)onlineApiBaseUrl {
    
    return @"https://api.umedcn.com:8443/youyueyizu_api";
}

//version
-(NSString *)offlineApiVersion {
    
    return @"";
}

-(NSString *)onlineApiVersion {
    
    return @"";
}

//privateKey
-(NSString *)onlinePrivateKey {
    
    return @"";
}

-(NSString *)offlinePrivateKey {
    
    return @"";
}
//publicKey

-(NSString *)onlinePublicKey {
    
    return @"";
}

-(NSString *)offlinePublicKey {
    
    return @"";
}
- (NSDictionary *)extraParmas {
    
    NSMutableDictionary *dic = @{}.mutableCopy;
    int rand = arc4random();
    NSString *timetamp = [NSString stringWithFormat:@"%lf%d",TimeStamp,rand];
    NSString *token = [CTAppContext sharedInstance].accessToken;
    NSString *sign = [NSString stringWithFormat:@"%@%@%@",timetamp,token,SALT];
    sign = [sign CT_md5];
    [dic setObject:timetamp?:@"error" forKey:@"timestamp"];
    [dic setObject:token?:@"error" forKey:@"token"];
    [dic setObject:sign?:@"error" forKey:@"sign"];
    return dic;

}
#undef TimeStamp
#undef SALT
@end
